Skip to content

Clarin9/Restrict main search page to items only - #1487

Closed
Kasinhou wants to merge 1 commit into
dtq-dev-9-basefrom
clarin9/search-items-only
Closed

Clarin9/Restrict main search page to items only#1487
Kasinhou wants to merge 1 commit into
dtq-dev-9-basefrom
clarin9/search-items-only

Conversation

@Kasinhou

@Kasinhou Kasinhou commented Aug 26, 2026

Copy link
Copy Markdown

Problem

On the main /search page the result list shows all DSpace object types — items, collections and communities — because the backend default discovery configuration indexes all of them. In v7 only items were shown on the search page.

Verified against the live v9 dev backend (dev-6):

  • configuration=default2373 results
  • configuration=default&dsoType=item2348 results (25 collections/communities filtered out)

Fix (frontend only)

Add a reusable forcedDsoTypes input to the (themed) SearchComponent. When set, those DSpaceObjectTypes are forced onto every search request the component makes (they map to dsoType= query params on the REST discover/search/objects call), regardless of the discovery configuration.

The main search page sets it to items only, so community/collection results are hidden from /search. Facets/filters are driven by the discovery configuration and are left untouched, as are all other search surfaces (MyDSpace, admin search, browse, scoped configuration searches).

Why this shape

  • Reusable, not hard-coded deep in the pipeline — any search surface can opt in, and it can later back a facet or a config toggle with almost no extra work.
  • Easy to revert / adjust — clearing SearchPageComponent.forcedDsoTypes restores the previous "all types" behaviour.
  • The force applies only when the request carries no explicit dsoTypes array; a caller that sets its own types is left untouched.

Changes

  • shared/search/search.component.ts — new @Input() forcedDsoTypes; injected into the combined search options (so results and CSV export stay consistent).
  • shared/search/themed-search.component.ts — thread the input through the themed wrapper.
  • search-page/search-page.component.{ts,html} — set forcedDsoTypes = [ITEM] on the main search page (shared by base + custom theme).
  • shared/search/search.component.spec.ts — test that the configured types are applied.

Testing

  • tsc -p tsconfig.app.json --noEmit passes.
  • Added unit test covering the forced-types injection.
  • Backend behaviour confirmed live via the REST dsoType filter (counts above).

🤖 Generated with Claude Code

@Kasinhou Kasinhou self-assigned this Aug 26, 2026
@Kasinhou
Kasinhou force-pushed the clarin9/search-items-only branch from 484c30b to d468754 Compare August 26, 2026 13:44
@Kasinhou
Kasinhou requested a lite review from Copilot September 1, 2026 11:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the shared search UI to allow callers to force specific DSpaceObjectType filters onto all search requests, and then uses that capability to restrict the main /search page to items only (matching legacy v7 behavior), without altering discovery configurations or other search surfaces.

Changes:

  • Add a reusable forcedDsoTypes input to SearchComponent and thread it through the themed wrapper.
  • Apply forcedDsoTypes = [ITEM] on the main search page template/component.
  • Add a unit test asserting that forced types are applied to computed search options.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/app/shared/search/themed-search.component.ts Proxies the new forcedDsoTypes input through the themed wrapper.
src/app/shared/search/search.component.ts Introduces @Input() forcedDsoTypes and injects it into the combined PaginatedSearchOptions used for searches/CSV export.
src/app/shared/search/search.component.spec.ts Adds a unit test to verify forced types are applied.
src/app/search-page/search-page.component.ts Defines forcedDsoTypes = [ITEM] for the main search page.
src/app/search-page/search-page.component.html Binds [forcedDsoTypes] into <ds-search> on /search.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/app/shared/search/search.component.ts Outdated
Comment thread src/app/shared/search/search.component.spec.ts
The main /search page previously returned all DSpace object types (items,
collections and communities), matching the backend `default` discovery
configuration. In v7 only items were shown there.

Add a reusable `forcedDsoTypes` input to the (themed) SearchComponent that
forces the given DSpaceObject types onto every search request the component
makes, and set it to items only on the main search page. Community and
collection results are therefore hidden from /search, while other search
pages (MyDSpace, admin, browse, scoped configuration searches) are untouched.

Clearing SearchPageComponent.forcedDsoTypes restores the previous behaviour,
and the input can be reused to expose this as a facet/config later.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Kasinhou

Kasinhou commented Sep 1, 2026

Copy link
Copy Markdown
Author

Superseded by backend PR dataquest-dev/DSpace#1423, which restricts the default Discovery search to items only at the source (single config value, applies to all API consumers — UI, REST, OAI — and to facet counts). Closing this UI-layer workaround as redundant.

@Kasinhou Kasinhou closed this Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants